<div class="footer">
  <div class="container">
  <div class="col-md-5 contact-section">
    <h4>建议留言</h4>
      <input type="text" class="text" placeholder="名字(必填)" id="name">
      <input type="text" class="text" placeholder="邮箱" id="email">
      <textarea name="content" id="content" placeholder="请提出您宝贵的建议......(必填)"></textarea>
      <p id="msg" style="color:red; font-size:20px;margin-bottom:10px;display:none"></p>
      <input type="submit" id="submit" value="提交">
  </div>
  <div class="col-md-7 follow-us">
    <h4>联系我们</h4>
<!--    <div class="social-icons">
      <i class="facebook"></i>
      <i class="twitter"></i>
      <i class="pinterest"></i>
      <i class="googlepluse"></i>
    </div> -->
{$contact.content}
    <div class="copyright">
      <p>Copyright &copy; 2016. All rights reserved.上海久泰木结构有限公司</p>
    </div>
  </div>
  <div class="clearfix"></div>
  </div>
</div>
<!-- FlexSlider -->
<link href="__PUBLIC__/css/flexslider.css" rel='stylesheet' type='text/css' />
  <script defer src="__PUBLIC__/js/jquery.flexslider.js"></script>
  <script type="text/javascript">
 
  $(function(){
    SyntaxHighlighter.all();
   
  });
 $('#submit').bind('click',sub_message);


   function sub_message(){
          var name= $('#name').val();
          var email= $('#email').val();
          var content= $('#content').val();
          if(name ==""){
            $('#msg').html('名字不能为空!').show();
            return;
          }
           var reg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
            if(!reg.test(email)){
             $('#msg').html('邮箱格式不正确!').show();
             return;
            }
         if(content == ""){
           $('#msg').html('内容不能为空!').show();
           return;
         }

               $.ajax({
                 url: "{:u('Index/message')}",
                 type: 'POST',
                 dataType: 'json',
                 data: {"name": name,
                        "email" : email,
                        "content" : content
                 },
                 complete: function(xhr, textStatus) {
                   //called when complete
                 },
                 success: function(data) {
                   if(data.status == 1){
                    $('#msg').html(data.msg).css('color','yellow').show();
                    setTimeout(function(){
                       $('#msg').html("").hide().css('color','red');
                    },1000);
                    $('#name').val('');
                    $('#email').val('');
                    $('#content').val('');
                   }else{
                    $('#msg').html(data.msg).show();
                    setTimeout(function(){
                       $('#msg').html("").hide();
                    },1000);
                    $('#name').val('');
                    $('#email').val('');
                    $('#content').val('');
                   }
                 },
                 error: function(xhr, textStatus, errorThrown) {
                   //called when there is an error
                 }
             });
 }


 
  $(window).load(function(){
    $('.flexslider').flexslider({
    animation: "slide",
    start: function(slider){
      $('body').removeClass('loading');
    }
    });
  });
  </script>

